<?php

namespace two;
require_once __DIR__ . '/../vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Wire\AMQPTable;

class Consumer02
{
    // 死信队列名称
    public static $deadQueue = 'dead_queue';

    public function __construct()
    {
        self::consumer02();
    }

    public static function consumer02()
    {
        $connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
        $channel = $connection->channel();

        $callback = function ($msg) {
            echo " [x] Received ", $msg->body, "\n";
        };

        $channel->basic_consume(self::$deadQueue, '', false, false, false, false, $callback);
    }

    /*
    public static function ()
    {

    }*/
}


new Consumer02();